<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<?php
include("conn.php");		//包含conn.php文件
if(isset($_POST['name']) && $_POST['name']!=""){//判断用户名是否存在
$sql=("insert into tb_user(name,pwd,sex,email) values('".$_POST['name']."','".$_POST['pwd']."','".$_POST['sex']."','".$_POST['email']."')");	
$result=mysql_query($sql,$conn);		//执行添加操作
	if($result){				//判断是否执行成功
	echo  "<script> alert('注册成功!'); window.location.href='landing.php'</script>";
	}else{
	echo  "<script> alert('注册失败!'); window.location.href='register.php'</script>";
	}
}
?>

</body>
</html>